Skip to main content

All Questions

Tagged with
0votes
0answers
58views

Wait for results/failure of an unreliable async operation

Abstract Problem The basic problem is that of producer/consumer. Wait for an async Producer to [produce an item] or [fail], together with a timeout on the consumer side. Using Java's ...
JayC667's user avatar
4votes
3answers
162views

Threads in Java with ExecutorService

I'm experimenting with Threads in Java and came upon the ExecutorService class. I've written the following code: ...
Fang's user avatar
  • 617
2votes
1answer
79views

Multithreaded Merge Sort Using ForkJoin Framework

I've implemented a multithreaded merge sort using Java's ForkJoin framework, and I wanted to gather feedback on its correctness, efficiency, and scalability. Here's my implementation: ...
Akash Gupta's user avatar
5votes
2answers
617views

Thread-safe write-efficient register() method for a Load balancer

The code below was written for an interview question of designing a load balancer with only a register() method. ...
drets's user avatar
3votes
1answer
123views

Amount Transfer Between Different Accounts - Improved Version

This is an improved code version for Amount Transfer Between Different Accounts Welcoming any further improvements for this. ...
Jill's user avatar
  • 297
4votes
1answer
216views

Amount Transfer Between Different Accounts

I implemented the below classes for transfer amount between different accounts. Used ConcurrentHashMap and Stamped Lock to handle concurrency. Am I missing any important concepts here? Are there any ...
Jill's user avatar
  • 297
6votes
2answers
876views

Reduce String Length With Thread Safety & Concurrency

I implemented the below URL Shortener class. Used ConcurrentHashMap to handle concurrency. Short URL building logic may not be optimal, but it ensures that only ...
Jill's user avatar
  • 297
5votes
2answers
465views

Implement service registry servers with load balancing strategies

Have Implemented below service registry class with 2 load balancing strategies.Used Strategy Pattern. Used Stamped lock ( Optimistic write locking) for ensuring thread safety and concurrency. Used ...
Jill's user avatar
  • 297
1vote
0answers
51views

Java multithreading with Spring JPA

I have to improve a process that is currently sequential, and i wanna make it multi-thread. This process uses Spring JPA, with spring boot 2 and java 17. I would like to have a feedback on the ...
Fabio Piunti's user avatar
2votes
2answers
129views

A thread-safe performant Money Transfer API in Java

This is a popular interview question. It is meant to be done within 30 minutes. The task is to implement a thread-safe performant Bank Account API that allows to transfer, deposit, withdraw and check ...
Sasha Shpota's user avatar
4votes
1answer
102views

Multithreaded Alpha-beta pruning for playing Connect Four in Java

Intro (The entire repository is in GitHub.) This time, I have parallelized the famous Alpha-beta pruning algorithm. The idea is that the parallel algorithm descends in a game tree (at least) 2 levels ...
coderodde's user avatar
7votes
2answers
1kviews

A thread-safe performant URL Shortener in Java

This is a popular interview question. It is meant to be done within 45 minutes. The task is to implement a thread-safe performant in-memory URL Shortener. My implementation is based on two maps that ...
Sasha Shpota's user avatar
5votes
3answers
114views

Time based cache for single element

The container should be thread safe and provide lazy load of data, and cache the data for set period of time. ...
trolkura's user avatar
2votes
2answers
142views

Multiple Producer and Multiple Consumer Implementation Using Locks and Semaphore

This solution has a total of four classes. Main.java: Class with main method. Execution starts here. ...
vvs14's user avatar
0votes
1answer
105views

decorator for an Executor that allows to get a List of running tasks

As stated in the javadoc below, this is intended for monitoring and debugging. I've found it especially useful for figuring out which tasks got stuck and prevented clean terminations of my ...
morgwai's user avatar

153050per page
close